package com.cy.aircompressor.main.ui.onlinemonitor.provider;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.cy.aircompressor.config.AirConfig;
import com.cy.aircompressor.databinding.ItemSingleWarningMsgBinding;
import com.cy.aircompressor.databinding.ItemWarningMsgBinding;
import com.cy.aircompressor.entity.warning.WarningMsg;
import com.drug.lib.view.recycptr.ItemViewBinder;
import com.net.model.base.BaseBindViewHolder;

//单台设备告警消息
public class SingleAirWarningMsgProvider extends ItemViewBinder<WarningMsg, SingleAirWarningMsgProvider.ViewHolder> {

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        return new ViewHolder(ItemSingleWarningMsgBinding.inflate(inflater, parent, false));
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder holder, @NonNull WarningMsg entity) {
        holder.mBinding.sensorName.setText(AirConfig.get().getSensorName(String.valueOf(entity.getSensorType())));
        holder.mBinding.compressorPart.setText(entity.getCompressorPartDesc());
        holder.mBinding.sensorValue.setText(entity.getValue() + "");
        holder.mBinding.occurrenceTime.setText(entity.getCreateTime());
        holder.mBinding.compressorPointDesc.setText(entity.getCompressorPointDesc());
    }

    public class ViewHolder extends BaseBindViewHolder<ItemSingleWarningMsgBinding> {

        protected ViewHolder(ItemSingleWarningMsgBinding itemView) {
            super(itemView);
        }
    }
}
